<template>
    <div>
        <!--资源添加页面-->
        <van-field label='资源名' placeholder="请输入" v-model="form.name"/>
        <van-field label="资源地址" placeholder="请输入" v-model="form.url"/>
        <van-button @click="add">资源添加</van-button>

    </div>
</template>

<script>
    export default {
        data() {
            return {
                form:{}
            }
        },
        methods: {
            add(){
                if(this.form.name == undefined || this.form.url == undefined){
                    
                    this.$toast.fail('必须填资源名称和资源地址')
                    return false
                }
                this.$axios.post('/user/resourcesadd/',this.form).then(res=>{
                    if(res.data.code == 200){
                        this.$toast.success(res.data.msg)
                    }else{
                        this.$toast.fail(res.data.msg)
                    }
                })
            }
        },
    }
</script>

<style scoped>

</style>